<%@page import="com.hahehiho.myalbum.Util"%>
<%@page import="java.lang.Thread.State"%>
<%@page import="com.hahehiho.myalbum.RecreateInfoStatus"%>
<%@page import="com.hahehiho.myalbum.MyAlbumDB"%>
<%@page import="com.hahehiho.myalbum.Indexer"%>
<%@page import="java.io.File"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%
String path = request.getParameter("path");
String refresh = request.getParameter("refresh");
String thumbnail = request.getParameter("thumbnail");
String db = request.getParameter("db");

if(path == null) {
	path = "/media/MGTEC/Picture";
}

if(refresh == null)
	refresh = "true";

if(thumbnail == null)
	thumbnail = "false";

if(db == null)
	db = "true";

RecreateInfoStatus info = Util.getWorker();

if(info == null || refresh.equalsIgnoreCase("false"))
	Util.startWorker(path, thumbnail, db);

info = Util.getWorker();

%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="viewport" content="user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0,width=device-width" />
<link rel="stylesheet" href="css/default.css" >
<title>create indexing....</title>
</head>
<body>
Status : closed=<%=info.isClose()%> <br>
Percentage : <%=info.getPercentage()%> % <br>
start : <%=info.getStartTime()%> <br>
end : <%=info.getEndTime()%> <br>
<br>
<a href="recreate.jsp?refresh=true">refresh</a> <br>
<a href="recreate.jsp?refresh=false">force recreate db</a> <br>
<a href="recreate.jsp?refresh=false&thumbnail=true">force recreate db with thumbnail</a> <br>
<a href="recreate.jsp?refresh=false&thumbnail=true&db=false">recreate only thumbnail</a> <br>

</body>
</html>